<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{margin: 0;padding: 0}
        #wrap{
            margin: 30px;
            width: 400px;
            height: 400px;
            border: 1px solid;
            position: relative;
        }
        #inner{
            width: 100px;
            height: 100px;
            background: pink;

            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;
        }
    </style>
</head>
<body>
    <!--
        绝对定位的盒子特性:
            盒模型相关的属性值(横向) + left + right = 包含块padding-box的尺寸(横向)
            盒模型相关的属性值(纵向) + top + bottom = 包含块padding-box的尺寸(纵向)
                auto + 0 + 0 + 100 + 0 + 0  = 400
    -->
    <div id="wrap">
        <div id="inner"></div>
    </div>

<div style="height: 10000px"></div>
</body>
</html>